﻿using System;
using System.Collections.Generic;
using ASPNETVN.PORTAL.Components.UI;
using ASPNETVN.PORTAL.Modules.ACTP.Components;

namespace ASPNETVN.PORTAL.Modules.ACTP.Controls
{
    public partial class ProjectGanttChart : ModulePage
    {
        //protected string GetGanttChartData()
        //{
        //    string jqueryCalendar = string.Empty;
        //    IList<Project> projects = Project.SelectCollectionBy_TeamID(this.ItemID);
        //    foreach (Project project in projects)
        //    {
        //        jqueryCalendar += "{";
        //        jqueryCalendar += string.Format("id: {0}, itemName: '{1}', series: [");
        //          jqueryCalendar += "{";
        //          jqueryCalendar += string.Format(" seriesName: '{0}' start: new Date({1}, {2}, {3}), end: new Date({4}, {5}, {6})", project.Code + " - " + project.Subject, project.StartDate.Year, project.StartDate.Month - 1, project.StartDate.Day, project.DueDate.Year, project.DueDate.Month - 1, project.DueDate.Day, project.ProjectID) + "},";
        //          jqueryCalendar += "}";
        //    }

        //    if (jqueryCalendar.LastIndexOf(",") > 0)
        //    {
        //        jqueryCalendar = jqueryCalendar.Remove(jqueryCalendar.LastIndexOf(","), 1);
        //    }
        //    return jqueryCalendar;
        //}
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                ProjectDetailControl1.ProjectID = this.ItemID;
                // Gantt chart.
                GanttChart.XmlData = "";
                GanttChart.Year = 2010;
                GanttChart.Quarter = 4;
                GanttChart.BlockColor = "blue";
                GanttChart.ToggleColor = "#dcdcdc";
                GanttChart.CellHeight = 15;
                GanttChart.CellWidth = 15;
                GanttChart.ProjectID = this.ItemID;

                // Tooltips.
                Project project = Project.Load(this.ItemID);
                rptTooltips.DataSource = Task.SelectBy_ProjectID_Include_Employee(project.ModuleID, project.ProjectID);
                rptTooltips.DataBind();
            }
        }
    }
}